{% extends 'admin-v2/layout.html.twig' %}
{% import "common/data-dict-macro.html.twig" as dict_macro %}

{% do script(['libs/jquery-validation.js', 'app/js/admin-v2/operating/certificate-template/step-one/index.js']) %}

{% set menu = 'admin_v2_certificate_template_manage' %}

{% block main %}
  <h4 class="mtl mbl">{{ 'admin.operation_certificate.template.create'|trans }}——{{ 'admin.operation_certificate.template.create.basic_message'|trans }}</h4>
  <form id="certificate-template-form" class="form-horizontal" method="post" action="
  {% if template|default() %}
    {{ path('admin_v2_certificate_template_edit', {id:template.id}) }}
  {% else %}
    {{ path('admin_v2_certificate_template_create') }}
  {% endif %}">

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="name" class="control-label-required">{{ 'admin.operation_certificate.template.title'|trans }}：</label>
      </div>
      <div class="col-md-3 controls">
        <input class="form-control" name="name" id="name" value="{{ template.name|default('') }}" placeholder="{{ 'admin.operation_certificate.template.title.placeholder'|trans }}">
      </div>
    </div>

    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
        <label for="targetType" class="control-label-required">{{ 'admin.operation_certificate.template.type'|trans }}：</label>
      </div>
      {% if template|default() %}
        <div class="col-md-3 controls mts">
          <span>{{ dict_macro.certificateTypes(template.targetType) }}</span>
        </div>
      {% else %}
        <div class="col-md-3 controls">
          <select class="form-control department-manage-search-form-group__type" id="targetType" name="targetType">
            {{ select_options(dict('certificateTypes'), app.request.get('targetType')|default(template.targetType|default())) }}
          </select>
        </div>
      {% endif %}
    </div>

    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
      </div>
      <div class="controls col-md-3">
        <button type="button" class="btn btn-primary ct-mrxl" id="create-certificate-template" data-submitting-text="{{ 'form.btn.save.submiting'|trans }}">{% if template|default() %}{{ 'form.btn.next'|trans }}{% else %}{{ 'form.btn.create'|trans }}{% endif %}</button>
        <a class="btn btn-default" href="{{ path('admin_v2_certificate_template_manage') }}">{{ 'form.btn.cancel'|trans }}</a>
      </div>
    </div>
    <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

  </form>
{% endblock %}